package com.eleadmin.common.system.controller;

import com.eleadmin.common.core.web.ApiResult;
import com.eleadmin.common.core.web.BaseController;
import com.eleadmin.common.core.web.PageResult;
import com.eleadmin.common.system.entity.Goods;
import com.eleadmin.common.system.param.GoodsParam;
import com.eleadmin.common.system.service.GoodsService;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
@RequestMapping("/goods")
public class GoodsController extends BaseController {

    @Autowired
    private GoodsService goodsService;

    @ApiOperation("商品列表展示")
    @PostMapping("/showGoods")
    public ApiResult<PageResult<Goods>> showGoods(@RequestBody GoodsParam goodsParam){
        PageResult<Goods> goodsPageResult = goodsService.showGoods(goodsParam);
        return success(goodsPageResult);
    }
}
